/*
* Copyright (c) 2014 Qunar.com. All Rights Reserved.
*/
package net.oschina.bilbodai.common.beanutil.property.test;

import net.oschina.bilbodai.common.beanutil.property.Property;

import java.util.HashMap;
import java.util.Map;

/**
 * @author qt-maodai  Date: 15-8-5 Time: 上午10:52
 * @version $Id$
 */
public class AttrProperty implements Property {

    private Student.ClassRoom room;

    public Object get(Object instance) {

        return ((Student) instance).getSchool().getClassRooms().get(6).getRemarks()[5].charAt(0);
    }

    public Object arrayGet(Object instance) {
        return ((Student) instance).getSchool().getLeader();
    }

    public Object listDeepGet(Object instance) {
        return ((Student) instance).getSchool().getClassRooms().get(1).getTips().get("ok");
    }

    public Object mapDeepGet(Object instance) {
        return ((Student) instance).getSchool().getClassRooms().get(1).getNums().get(1);
    }

    public Object mmapDeepGet(Object instance) {
        return ((Student) instance).getSchool().getClassRooms().get(1).getMales().get(1l);
    }

    public Object lmapDeepGet(Object instance) {
        return ((Student) instance).getSchool().getClassRooms().get(1).getLoops().get(1.2f);
    }

    public Object ccmapDeepGet(Object instance) {
        return ((Student) instance).getSchool().getClassRooms().get(1).getExtras().get(room);
    }

    public Object mapGet() {
        Map map = new HashMap();

        map.get(100);
        map.get((byte) 100);
        map.get((short) 100);
        map.get("key");
        map.get((long) 100);
        map.get(100.0f);
        map.get(100.1);
        map.get(Boolean.valueOf(true));
        map.get(true);
        map.get(false);
        ((Student.ClassRoom)map.get("name")).getTips();

        HashMap<String, Student.ClassRoom> rs = new HashMap<String, Student.ClassRoom>();
        rs.put("name", new Student.ClassRoom());
        rs.get("name").getTips();

        return null;
    }

    public Object mapPut() {
        Map map = new HashMap();

        map.put(1, 2);

        return null;
    }
}